import {getWarnings} from  "@/api/request"
import "./warningInfo.css"
const warningInfo = function(viewer){
    var self = this
    this.Info = {
        zoneTotal:0,
        alarmTotal:0
    }
    this.Div = document.createElement("div");
    this.Div.className = "widget-warnningInfo";
    var zoneTotal = 0
    var alarmTotal = 0
    var netErroTotal = 0
    this.Div.innerHTML = `<ul class="warningList">
        <li class="zoneTotal"><span>${zoneTotal}</span><span>地址体数</span></li>
        <li class="alarmTotal"><span>${alarmTotal}</span><span>预警条数</span></li>
        <li class="netErroTotal"><span>${netErroTotal}</span><span>网关异常</span></li>
    </ul>`;
    var ViewDom = viewer.container
    ViewDom.appendChild(this.Div);
}
warningInfo.prototype = {
    getData:function(){
        getWarnings().then(res=>{
            var zoneTotal = res.data.data[0].zs
            var alarmTotal = res.data.data[1].zs
            this.Div.innerHTML = `<ul class="warningList">
                <li class="zoneTotal"><span>${zoneTotal}</span><span>地址体数</span></li>
                <li class="alarmTotal"><span>${alarmTotal}</span><span>预警条数</span></li>
                <li class="netErroTotal"><span>0</span><span>网关异常</span></li>
            </ul>`;
           
        })
    }
}
export default warningInfo